package org.zxstudio.encrypt.utils;

import java.io.File;
import java.util.Comparator;

import org.zxstudio.encrypt.MediaBean;

public class MediaComparator implements Comparator<MediaBean> {

	@Override
	public int compare(MediaBean lhs, MediaBean rhs) {
		if (lhs.type > rhs.type) {
			return -1000;
		} else if (lhs.type < rhs.type) {
			return 1000;
		}

		File file1 = new File(lhs.data);
		File file2 = new File(rhs.data);
		if (file1 != null & file2 != null) {
			return file1.getName().toLowerCase()
					.compareTo(file2.getName().toLowerCase());
		}
		return 1000;
	}

}
